package com.itheima.consumer.config;

import com.rabbitmq.client.AMQP;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created with IntelliJ IDEA 2023.
 * Description:
 * User: homechen
 * Date: 2024-04-20
 * Time: 19:46
 */
@Configuration
public class DirectQueue {
    @Bean
    public DirectExchange directExchange1() {
        return new DirectExchange("ttt.direct2");
    }

    @Bean
    public Queue directQueue3() {
        return new Queue("direct.queue3");
    }

    @Bean
    public Binding bindingQueue2(DirectExchange directExchange1, Queue directQueue3) {
        return BindingBuilder.bind(directQueue3).to(directExchange1).with("red"); // 设置key值
    }
}
